package com.example.doma.mapper;

import com.example.doma.pojo.dorm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface dormMapper {
        @Select("select * from dorm")
        List<dorm> getdorms();
        dorm getdormByapart_numAnddormi_num(@Param("apart_num") String apart_num,@Param("dormi_num") int dormi_num);
        int update(@Param("dor") dorm dor);
        int adddorm(@Param("dor") dorm dor);
        int adddorms(@Param("dorms") List<dorm> dorms);
        int getpage();
        int deletedormByapart_numAnddormi_num(@Param("apart_num") String apart_num,@Param("dormi_num") int dormi_num);
        //获取同班宿舍，且宿舍有空床
       List<dorm> getdormsByspec_nameAndclass_nameAndgrade(@Param("spec_name") String spec_name,@Param("class_name") String class_name,@Param("grade") int grade,@Param("sex") int sex);

       //获取同专业学生空余宿舍
     List<dorm> getdormsByspec_nameAndgrade(@Param("spec_name") String spec_name,@Param("grade") int grade,@Param("sex") int sex,@Param("class_name") String class_name);
     //获取同院级宿舍学生
        List<dorm> getdormsByfaculty_nameAndBygrade(@Param("faculty_name") String faculty_name,@Param("grade") int grade,@Param("sex") int sex,@Param("spec_name") String spec_name );



}
